import { networkTypePageSelect } from '@/api/network'
import { NetworkTypeOptional } from '@/components/pages/order/list/assign-network/types'
import { ref } from 'vue'

// 部门类型选项
const networkTypeOptions = ref<Array<NetworkTypeOptional>>([])

// 获取部门类型选项
const getNetworkTypeOptionsLoading = ref(false)

/**
 * 获取部门类型下拉选项方法
 */
const getNetworkTypeOptions = async (keyword = '') => {
  getNetworkTypeOptionsLoading.value = true
  const res = await networkTypePageSelect({
    limit: 0,
    name: keyword,
    page: 0,
  })
  networkTypeOptions.value = res.data.success ? res.data.data.rows : []
  getNetworkTypeOptionsLoading.value = false
}

export default {
  networkTypeOptions,
  getNetworkTypeOptionsLoading,
  getNetworkTypeOptions,
}
